
public class e058 {
    public static void main(String[] args) {
        long sTime = System.currentTimeMillis();
        int primes = 0;
        int layers = 1;
        int toNums = 1;
        double ratio = 0;
        for (int i = 3; ; i += 2) {
            int dL = (i * i) - i + 1;
            int uL = (i * i) - (2 * i) + 2;
            int uR = (i * i) - (3 * i) + 3;
            if (isPrime(dL)) primes++;
            if (isPrime(uL)) primes++;
            if (isPrime(uR)) primes++;
            toNums += 4;
            ratio = (double)primes / (double)toNums;
            layers += 2;
            if (ratio < 0.1) {
                break;
            }
        }
        System.out.println(layers);
        long fTime = System.currentTimeMillis();
        System.out.println("Time: " + (fTime - sTime) + "ms");
    }

    static boolean isPrime(int i) {
        for (int j = 2; j <= Math.sqrt(i); j++) {
            if (i % j == 0) {
                return false;
            }
        }
        return true;
    }
}